home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / UTILITY / FDATE68A.ARJ / JDATE.BAT < prev    next >
DOS Batch File  |  1992-07-30  |  2KB  |  71 lines

  1. @echo off
  2.  
  3. goto enddoc
  4.  
  5. This batch file was created by Aran Spence [CIS: 70162,3044].  Its
  6. function is to emulate the DOS DATE command, but allow the user to set
  7. the date using a business julian date format (yyjjj) instead of
  8. mm-dd-yy.
  9.  
  10. Note the format is YYjjj. This is the BUSINESS julian date: a date
  11. expressed as the number of days from the beginning of the year,
  12. when January 1 is day 1.
  13.  
  14.            date      BUSINESS julian date
  15.        -----------   --------------------
  16.        Jan 5, 1992       92005
  17.        Jan 5, 1993       93005
  18.        Dec 31, 1993      93365  [Dec 31 is 365th day of year 1993]
  19.  
  20. As Aran originally wrote it, the user-prompt was virtually identical to
  21. that of the DATE command.  I have modified his original version, so it
  22. now looks less like the DATE command but displays a bit more
  23. information, and so it can operate from the command line even if the
  24. user does not have GET.
  25.  
  26. If the user enters a business julian date as a command-line
  27. parameter, JDATE resets the date to that julian date.
  28.              EXAMPLE:  JDATE 92005
  29. If there is no input parameter, GET is used to prompt the user for a
  30. date.  It is possible to use JDATE even if you don't have GET by
  31. operating only from the command line, or by substituting some other
  32. utility (such as STRINGS) for GET.
  33.  
  34. Note that the user must enter both of the year digits (yy),
  35. but may enter an abbreviated set of day digits (jjj).  That is,
  36. for julian day 92005, the user is permitted to enter 925.
  37.  
  38. One handy use for JDATE is simply to find out what the current
  39. business julian date is.
  40.  
  41. :enddoc
  42.  
  43. SET NewJD=%1
  44. if not (%NewJD%)==() goto GotDate
  45.  
  46. :ShowDate
  47. Fdate /Ff /Od1    /P"Current Gregorian date: "
  48. Fdate /Ff /Oyyjjj /P"Current Julian date is: "
  49.  
  50. :GetDate
  51. GET S "Enter new date (yyddd): " /VNewJD /L
  52. if (%NewJD%)==() goto endit
  53.  
  54. :GotDate
  55. Fdate /Ff /A%NewJD% /Omm-dd-yy /Iyyjjj /P"@DATE " > JUNKTEMP.BAT
  56. if errorlevel 1 if exist JUNKTEMP.BAT del JUNKTEMP.BAT
  57. if errorlevel 1 echo Invalid date "%NewJD%"
  58. if errorlevel 1 goto GetDate
  59.  
  60. rem  reset the date by calling JUNKTEMP.BAT
  61. call JUNKTEMP.BAT
  62. del  JUNKTEMP.BAT
  63.  
  64. echo SYSTEM DATE HAS BEEN RESET
  65. Fdate /Ff /Od1    /P"Current Gregorian date: "
  66. Fdate /Ff /Oyyjjj /P"Current Julian date is: "
  67.  
  68. :endit
  69. SET NewJD=
  70. echo.
  71.